package project_package;

import java.util.Calendar;

public class Employee extends Person
{
	double salary;
	double salesTotal;
	int salesNumber;
	boolean isManager;
	String password;
	
	public Employee(int id, String name, String phoneNo, String address, long civilNum, double salary, boolean isManager, String password, double salesTotal, int salesNumber)
	{
	    super(id, name, phoneNo, address, civilNum);
		this.salary = salary;
		this.salesTotal = salesTotal;
		this.salesNumber = salesNumber;
		this.isManager = isManager;
		this.password = password; 
	}

	public double getSalary() 
	{
		return salary;
	}
	
	public void setSalary(double salary) 
	{
		this.salary = salary;
	}
	
	public boolean getIsManager() 
	{
		return isManager;
	}
	
	public void setIsManager(boolean isManager)
	{
		this.isManager = isManager;
	}
	
	public String getPassword() 
	{
		return password;
	}
	
	public void setPassword(String password)
	{
		this.password = password;
	}
	
	public double getSalesTotal()
	{
		return salesTotal;
	}
	
	public void setSalesTotal(double salesTotal)
	{
		this.salesTotal = salesTotal;
	}
	
	public int getSalesNumber() 
	{
		return salesNumber;
	}
	
	public void setSalesNumber(int salesNumber)
	{
		this.salesNumber = salesNumber;
	}
	
	public void updateSales(double salesTotal)
    {
		setSalesNumber(salesNumber+1);
		setSalesTotal(this.salesTotal+salesTotal);
    }
    
	public void printEmployeeInfo()
	{
		Calendar employeeSince = Calendar.getInstance();
		employeeSince.setTimeInMillis(super.getDatestamp()*1000);
		String since = employeeSince.get(Calendar.DAY_OF_MONTH)+"."+employeeSince.get(Calendar.MONTH)+"."+employeeSince.get(Calendar.YEAR)+" "+employeeSince.get(Calendar.HOUR_OF_DAY)+":"+employeeSince.get(Calendar.MINUTE);

		System.out.println("Employee ID: " + super.getID());
		System.out.println("Employee CPR" + super.getCivilNum());
		System.out.println("Employee Name: " + super.getName());
		System.out.println("Employee Address: " + super.getAddress());
		System.out.println("Employee PhoneNo: " + super.getPhoneNo());
		System.out.println("Employee Salary: " + salary);
		System.out.println("Employee Sales Total Price: " + salesTotal);
		System.out.println("Employee Sales Total Number: " + salesNumber);
		System.out.println("Employee Type: " + (isManager ? "Manager" : "Normal"));
		System.out.println("Employee Since: " + since);
	}
}